﻿using FrameworkCore.Extensions;
using FrameworkCore.Modules.Startups;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace Infrastructure.Startups;

/// <summary>
/// 启用静态文件
/// </summary>
public partial class AiBLSmartEduStaticFilesStartup : IAiBLSmartEduStartup
{
    /// <summary>
    /// 添加和配置任何中间件
    /// </summary>
    /// <param name="services">服务描述符集合</param>
    /// <param name="configuration">应用程序的配置</param>
    public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
    {
        //// 压缩
        //services.AddResponseCompression();
    }

    /// <summary>
    /// 配置添加的中间件的使用
    /// </summary>
    /// <param name="application">用于配置应用程序请求管道的构建器</param>
    public void Configure(IApplicationBuilder application)
    {
        //// 启用响应压缩中间件
        //application.UseResponseCompression();

        // 使用静态文件功能
        application.UseAiBLSmartEduStaticFiles();
    }

    /// <summary>
    /// 获取此启动配置实现的顺序
    /// </summary>
    public int Order => 99; // 静态文件应该在路由和自定义中间件之前注册
}
